
import 'Definition.dart';
import 'UserModel.dart';

class RtcRoomModel extends Definition {
  
	/// 房间编号
	String? room_id;
	/// 房间名称
	String? room_name;
	/// 用户集合
	String? user_ids;
	/// 创建用户ID
	int? created_by;
	/// 本地用户ID
	int? user_id;
	/// 创建时间
	String? created_dt;
	/// 更新时间
	String? updated_dt;
	UserModel? owner;
	/// 房间中所有的用户
	List<UserModel>? users;

  @override
  Map<String, dynamic> toJson() {
    return {
			"room_id": room_id,
			"room_name": room_name,
			"user_ids": user_ids,
			"created_by": created_by,
			"user_id": user_id,
			"created_dt": created_dt,
			"updated_dt": updated_dt,
			"owner": owner?.toJson(),
			"users": users?.map((e) => e.toJson()).toList(),
    };
  }

  @override
  void fromJson(Map<String, dynamic> json) {
		room_id = json["room_id"];
		room_name = json["room_name"];
		user_ids = json["user_ids"];
		created_by = json["created_by"];
		user_id = json["user_id"];
		created_dt = json["created_dt"];
		updated_dt = json["updated_dt"];
		owner = json["owner"] == null ? null : (UserModel()..fromJson(json["owner"]));
		users = (json["users"] as List?)?.map<UserModel>((e) => UserModel()..fromJson(e)).toList();
  }
  
}
  